function compileContainer(self)
{
    self.Container = Class.create(
    {
        /**
         * Constructor.
         * 
         * @param range The range of coordinates specifying the size of the container.
         * @param hidden Whether or not the page is initially hidden.
         * @param containerDivId The entire container.
         * @param disabledContainerDivId The disabled container.
         * @param parentContainer A parent container, if required. Position and size will be calculated relative to the parent.
         */
        initialize: function(range, hidden, containerDivId, disabledContainerDivId, parentContainer)
        {
            this.range = range;
            this.containerDiv = jQuery('#' + containerDivId);
            if (disabledContainerDivId != null)
            {
                this.disabledContainerDiv = jQuery('#' + disabledContainerDivId);
            }
            this.parentContainer = parentContainer;
            
            // Hide?
            if (hidden)
            {
                this.containerDiv.hide();
            }
        },
        
        /**
         * Shows the container.
         */
        show: function()
        {
        	this.containerDiv.show();
        	
        	// Recalculate dimensions.
        	this.setDimensions(this.range);
        },
        
        /**
         * Hides the container.
         */
        hide: function()
        {
            this.containerDiv.hide();
        },
        
        /**
         * Sets the dimensions of the container.
         * 
         * @param range The range of coords.
         */
        setDimensions: function(range)
        {
        	this.range = range;
        	this.containerDiv.css('left', range.topLeft.x);
        	this.containerDiv.css('top', range.topLeft.y);
        	if (this.parentContainer)
        	{
        		var parentDiv = this.parentContainer.containerDiv;
        		this.containerDiv.css('right', parentDiv.width() - range.bottomRight.x);
        		if (!range.useMaxHeight)
        		{
                    this.containerDiv.css('bottom', parentDiv.height() - range.bottomRight.y);
        		}
        		else
        		{
        			this.containerDiv.css('max-height', range.bottomRight.y - range.topLeft.y);
        		}
        	}
        	else
        	{
        	   this.containerDiv.css('right', AppInfo.viewportWidth - range.bottomRight.x);
        	   if (!range.useMaxHeight)
               {
        	       this.containerDiv.css('bottom', AppInfo.viewportHeight - range.bottomRight.y);
               }
               else
               {
                   this.containerDiv.css('max-height', range.bottomRight.y - range.topLeft.y);
               }
        	}
        },
        
        /**
         * Anchors the container to the viewport. 
         */
        anchorContainer: function()
        {
            // Keep reference to anchor points.
            var borderRange = new Range(this.range.topLeft, new Coords(AppInfo.viewportWidth-this.range.bottomRight.x, AppInfo.viewportHeight-this.range.bottomRight.y));
       
            // Add resize handler to container.
            AppInfo.addResizeHandler(
              function(self, borderRange)
              {
                return function()
                {
                    var range = new Range(borderRange.topLeft,
                      new Coords(AppInfo.viewportWidth - borderRange.bottomRight.x, AppInfo.viewportHeight - borderRange.bottomRight.y));
                    self.setDimensions(range);
                }
              }(this, borderRange));
        },
        
        /**
         * Disables the container.
         */
        disable: function()
        {
        	if (this.disabledContainerDiv)
        	{
        		this.disabledContainerDiv.show();
        	}
        },
        
        /**
         * Enables the container.
         */
        enable: function()
        {
        	if (this.disabledContainerDiv)
        	{
        		this.disabledContainerDiv.hide();
        	}
        }
    });
}
